<script type="text/javascript" src="/application/js/jquery.itextclear.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
});
</script>
<h1 class="page-title">Novo Paciente</h1>
<div class="container_12 clearfix leading">
	<div class="grid_12">
		<div id="message"></div>
		<div id="new-patient">
			<form class="form has-validation" action="" method="POST" > 
				<input type="hidden" name="new_patient"  value="1"/>
				<div class="clearfix">
					<label for="form-p_name" class="form-label">Nome <em>*</em></label>
					<div class="form-input"><input type="text" id="form-p_name" name="p_name" required="required" placeholder="Nome do Paciente" value="" /></div>
				</div>
				<div class="clearfix">
					<label for="form-p_age" class="form-label">Idade</label>
					<div class="form-input"><input type="text" id="form-p_age" pattern="[0-9]*" name="p_age" placeholder="Idade" value="" /></div>
				</div>
				<div class="clearfix">
					<label for="form-p_weight" class="form-label">Peso</label>
					<div class="form-input"><input type="text" id="form-p_weight" pattern="[0-9]*(\.[0-9][0-9]*)*" name="p_weight" placeholder="Peso do Paciente" value=""/></div>
				</div>
				<div class="clearfix">
					<label for="form-p_height" class="form-label">Altura</label>
					<div class="form-input"><input type="text" id="form-p_height"  pattern="[0-9]*(\.[0-9][0-9]*)*" name="p_height" placeholder="Altura" value=""/></div>
				</div>
				<div class="clearfix">
					<label for="form-p_email" class="form-label">Email <em>*</em></label>
					<div class="form-input"><input type="email" id="form-p_email" name="p_email" required="required" placeholder="Email" value=""/></div>
				</div>
				<div class="clearfix">
					<label for="form-p_password" class="form-label">Senha <em>*</em></label>
					<div class="form-input"><input type="password" id="form-p_password" name="p_password" placeholder="Senha" value=""/></div>
				</div>
				<div class="clearfix">
					<label for="form-p_password2" data-equals="p_password" class="form-label">Confirmar a Senha <em>*</em></label>
					<div class="form-input"><input type="password" data-equals="p_password" id="form-p_password2" name="p_password2" required="required" placeholder="Repita a Senha" value=""/></div>
				</div>					
				<div class="form-action clearfix">
					<div class="button submit">Salvar</div>
					<button class="button" type="reset">Limpar</button>
				</div>
			</form>
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		$('.button.submit').click(function() {
			form = $('form');
			data = form.serializeArray();
			$.post('/ajax/new_patient',data,function(r){
				$('#message').html('<div class="message success closeable">	<span class="message-close"></span><h3>Sucesso!</h3><p> O paciente foi registrado! (id:'+r+')</p></div>');
				form.reset();
			});
		});
	});
</script>
    <!-- WIZARD SETUP END -->
